import {inject, observer} from "mobx-react";
import {Button} from 'antd';
import { WeaTableNew } from 'comsMobx';
let WeaTable = WeaTableNew.WeaTable;
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

@inject("coworkTestStore")
@observer
class MobxComp extends React.Component {
	constructor(props) {
		super(props);
	}
	componentDidMount() {
    const {coworkTestStore} = this.props;
    coworkTestStore.getDatas();
	}
	render() {
	  const {coworkTestStore} = this.props;
    const {state_1, table} = coworkTestStore;
    const {data} = state_1;
    const {dataKey} = table;
		return (
			<div>
        MobxComp
        <div>
          <Button onClick={this.add}>{getLabel(1421, '新增')}</Button>
          <ul>
            {data.map((o) => {
              return <li>{o.name}</li>
            })}
          </ul>
        </div>
        <div>
          <WeaTable sessionkey={dataKey}></WeaTable>
        </div>
      </div>
		);
	}
	add = () => {
    const {coworkTestStore}=this.props;
    coworkTestStore.addDataInState1();
	}
}
export default MobxComp;